import { compileTpFunction } from "./compiler/compiler";
import { initMixin } from "./init";
import { initLifeCycle } from "./lifecycle";
import { initStateMixin } from "./state";
import { createElm, patch } from "./vdom/patch";

function Vue(options) {
  this._init(options);
}
initMixin(Vue); //扩展init方法
initLifeCycle(Vue);
initStateMixin(Vue);
export default Vue;

let render1 = compileTpFunction(`<ul style="color: red;"></ul>`);
let vm1 = new Vue({ data: { name: "jdw" } });
let prevVnode = render1.call(vm1);

let el = createElm(prevVnode);
document.body.appendChild(el);

let render2 = compileTpFunction(`<ul  style="color: red;"></ul>`);
let vm2 = new Vue({ data: { name: "jdw" } });
let nextVnode = render2.call(vm2);

setTimeout(() => {
  patch(prevVnode, nextVnode);
}, 1000);
